package com.diudiutechnology.www.yadiudiu.yadiudiu.house.MyActivity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.diudiutechnology.www.yadiudiu.R;
import com.diudiutechnology.www.yadiudiu.util.utils.Dialog;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/8/18.
 * 购房联系支付页面
 */

public class PaymentActivity extends Activity implements View.OnClickListener {
    @Bind(R.id.retur)//返回
    LinearLayout retur;


    @Bind(R.id.button)//去支付
    Button button;

    @Bind(R.id.pay_amount)//支付金额
            TextView payAmount;

    Context context;
    AlertDialog alertDialog;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_payment);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        context = this;
        payAmount.setText(Html.fromHtml("支付金额：<font color='#FD1142'>1元</font>"));
        retur.setOnClickListener(this);
        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.retur:
                finish();
                break;
            case R.id.button:
                alertDialog= Dialog.phonedialog(context, "15826137262", "", new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Intent intent = new Intent(Intent.ACTION_DIAL);
                        Uri data = Uri.parse("tel:15826137262");
                        intent.setData(data);
                        context.startActivity(intent);
                        alertDialog.dismiss();
                    }
                },"确定","取消");
                break;

        }
    }
}
